import {select} from "../api/common"
import Vue from 'vue'

export default {
  namespaced: true,
  state: {
    // 所有下拉选
    selections: {},
  },
  actions: {
    getSelections(context) {
      select().then(
          response => {
            if (response.code == 200) {
              context.commit("SET_SELECTIONS", response.data)
            }
          }
        )
    }
  },
  mutations: {
    SET_SELECTIONS(state, selections) {
      // state.selections = selections
      //一定要响应式，不然vue页面获取不到更新后的值
      Vue.set(state,'selections', selections  )
      console.log("selections: ", state.selections);
    }
  }
}
